From 07ff664b8578eadd55625d6063f22bef3754de13 Mon Sep 17 00:00:00 2001 From: Alexandre Ghiti Date: Wed, 15 Sep 2021 11:24:38 +0200 Subject: [PATCH] [PATCH] CMakeLists.txt: Handle 'undefined' values returned by getconf This allows to avoid build failures when using qemu user mode for riscv64 [1]: the corresponding bug in qemu [2] will get fixed but handling that here allows to keep pocl buildable by old qemu versions. [1]: https://bugs.launchpad.net/ubuntu/+source/pocl/+bug/1942895 [2]: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1942884 Signed-off-by: Alexandre Ghiti Gbp-Pq: Name 1002-CMakeLists.txt-Handle-undefined-values-returned-by-g.patch --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5183b15..014fea1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -421,6 +421,10 @@ if(NOT HOST_CPU_CACHELINE_SIZE) message(WARNING "getconf exited with nonzero status!") set(CL_SIZE 0) else() + # getconf may in rare conditions return "undefined" value + if (CL_SIZE STREQUAL "undefined\n") + set(CL_SIZE 0) + endif() # getconf sometimes just returns zero if(NOT (CL_SIZE EQUAL 0)) string(STRIP "${CL_SIZE}" CL_SIZE) -- 2.30.2